﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Commander.Structures;

namespace Commander.Views
{
    /// <summary>
    /// Логика взаимодействия для newCopy.xaml
    /// </summary>
    public partial class newCopy : Window
    {
        private Point old;
        private Info data;

        public newCopy()
        {
            InitializeComponent();
        }

        public Info Data
        {
            set
            {
                data = value;
            }
        }

        private void Close_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            label1.Content = data.OldPatch;
            textBox1.Text = data.NewPatch;
        }

        private void Copy_Click(object sender, RoutedEventArgs e)
        {
            data.NewPatch = textBox1.Text;
            Copy cp;
            data.Type = comboBox1.Text;
            cp = new Copy(data);
            cp.Show();
            this.Close();
        }

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            old = e.GetPosition(null);
        }

        private void Window_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                Point cur = e.GetPosition(null);
                this.Left += cur.X - old.X;
                this.Top += cur.Y - old.Y;
            }
        }
    }
}
